package day04;

public class ExtendedExercises {
    public static void main(String[] args) {
        //1.输出1900到2023年之间所有的闰年(每够10个年份，换一行
        int count = 0;
        for (int year = 1900; year <= 2023; year++) {
            if (year % 4 == 0 && year / 100 != 0 || year % 400 == 0) {
                System.out.print(year + "\t");
                count++;
                if (count % 10 == 0) {
                    System.out.println();
                }
            }
        }System.out.println();

        //2.利用for循环计算：求数字1到100之内，所有偶数的和，并输出
        int sum = 0;
        for (int i = 0; i <= 100; i+=2 ){
            sum+=i;
        }System.out.println("sum="+sum);

        //3.利用for循环计算：求8的阶乘，并输出
        int num = 1;
        for (int i =1;i <=8;i++){
            num*=i;
        }
        System.out.println(num);

        //4.利用for循环计算：打印字符*组成的直角三角形，输出结果如下所示：

        for (int i=1;i<=6;i++){
            for (int a = 1;a <= 2*i-1;a++){
            System.out.print("*");
        }
        System.out.println();
    }
}
}
